import Components from 'unplugin-vue-components/vite'
import {
  ElementPlusResolver
} from 'unplugin-vue-components/resolvers'
import IconsResolver from 'unplugin-icons/resolver'

export default function createComponents() {
  return Components({
    resolvers: [
      // 自动注册图标组件
      IconsResolver({
        enabledCollections: ['ep'],
      }),
      // 自动导入 Element Plus 组件
      ElementPlusResolver()
    ],
    extensions: ['vue'],
    deep: true,
    dts: "src/components/components.d.ts"
    // 还可以指定特定的目录或正则表达式
    // directories: ['src/my-components'],
  })
}